<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>网站信息</title>
<link rel="stylesheet" href="HNUST/../../user/css/pintuer.css">
<link rel="stylesheet" href="HNUST/../../user/css/admin.css">
<script src="HNUST/../../user/js/jquery.js"></script>
<script src="HNUST/../../user/js/pintuer.js"></script>
<script type="text/javascript">
	function del(tavern_id){
		if(confirm("你真的忍心么！")){
			$.ajax({
				type:"GET",
				url:"/HNUST/tavern/del",
				data:{tavern_id:tavern_id},
				dataType:"json",
				success:function(data){
					alert(data.result);
					location.reload();	
				},
				error:function(data){
					alert("删除失败！");
				}
			});
		}
	}
</script>
</head>
<body>
	<div class="panel admin-panel">
		<div class="panel-head">
			<strong class="icon-reorder"> 内容列表</strong>
		</div>
		<div class="padding border-bottom">
		
			<a class="button border-yellow" href="add"><span
				class="icon-plus-square-o"></span> 添加内容</a>
		</div>
		<table class="table table-hover text-center">
			<tr>
				<th width="5%">ID</th>
				<th>栏目名称</th>
				<th>价格</th>
				<th>路线</th>
				<th>图片</th>
				<th>创建时间</th>
				<th width="250">操作</th>
			</tr>
          <c:forEach items="${tavern }" varStatus="i" var="taverns">
			<tr>
				<td>${i.index+1 }</td>
				<td>${taverns.tavern_name }</td>
				<td>${taverns.tavern_price }</td>
				<td>${taverns.tavern_path }</td>
				<td width="10%"><img src="${taverns.tavern_prcture }" alt="" width="120" height="70" /></td>
				<td>${taverns.tavern_time }</td>
				<td>
					<div class="button-group">
						<a type="button" class="button border-main" href="update?tavern_id=${taverns.tavern_id }"><span
							class="icon-edit"></span>修改</a>
					<button class="button bg-main icon-trash-o" onclick="del(${taverns.tavern_id});">删除</button>
					</div>
				</td>
			</tr>
			</c:forEach>
					<tr>
					<td colspan="8"><div class="pagelist">
						<!-- 分页功能 start -->
							<div align="center">
								<font size="2">共 ${page.totalPageCount} 页</font> <font size="2">第
									${page.pageNow} 页</font> <a href="List?pageNow=1">首页</a>
								<c:choose>
									<c:when test="${page.pageNow - 1 > 0}">
										<a href="List?pageNow=${page.pageNow - 1}">上一页</a>
									</c:when>
									<c:when test="${page.pageNow - 1 <= 0}">
										<a href="List?pageNow=1">上一页</a>
									</c:when>
								</c:choose>
								<c:choose>
									<c:when test="${page.totalPageCount==0}">
										<a href="List?pageNow=${page.pageNow}">下一页</a>
									</c:when>
									<c:when test="${page.pageNow + 1 < page.totalPageCount}">
										<a href="List?pageNow=${page.pageNow + 1}">下一页</a>
									</c:when>
									<c:when test="${page.pageNow + 1 >= page.totalPageCount}">
										<a href="List?pageNow=${page.totalPageCount}">下一页</a>
									</c:when>
								</c:choose>
								<c:choose>
									<c:when test="${page.totalPageCount==0}">
										<a href="List?pageNow=${page.pageNow}">尾页</a>
									</c:when>
									<c:otherwise>
										<a href="List?pageNow=${page.totalPageCount}">尾页</a>
									</c:otherwise>
								</c:choose>
							</div>
							<!-- 分页功能 End -->
						</div></td>
				</tr>
		</table>
	</div>
</body>
</html>